package com.yonyou.ucf.mdf.app.isvdxq.other.model;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yonyou.ucf.mdf.app.isvdxq.other.entity.ManageClassEntity;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ManageClassBean extends ManageClassEntity {
    private Object name;

    public String getName() {
        if(name == null) return null;
        if(name instanceof String) return name.toString();
        else{
            NameBean obj = JSONObject.parseObject( JSONObject.toJSONString(name), NameBean.class );
            return obj.getZh_CN();
        }
    }

    public void setName(Object name) {
        NameBean obj = new NameBean();
        if(name instanceof String) {
            obj.setZh_CN(name.toString());
        }
        else{
            obj = JSONObject.parseObject( JSONObject.toJSONString(name), NameBean.class );
        }
        this.name = obj;
        this.setClassname(obj.getZh_CN());
    }

    public void setStopstatus(boolean stopstatus) {
        if (stopstatus) {
            this.setStopstatus(0);
        } else {
            this.setStopstatus(1);
        }
    }

    private boolean isEnabled;

    public boolean isEnabled() {
        return isEnabled;
    }

    public void setEnabled(boolean enabled) {
        isEnabled = enabled;
        if (enabled) {
            this.setStopstatus(0);
        } else {
            this.setStopstatus(1);
        }
    }
}
